import { Query } from 'mongoose';

export function to(promise: Query<any, any, any, any>): Promise<any[]> {
  return promise
    .then((data) => {
      return [null, data];
    })
    .catch((err) => {
      return [err];
    });
}
